﻿using AutoMapper;
using Nop.Admin.Models.Vendors;
using Nop.Admin.Models.WindAlert;
using Nop.Core.Domain.Vendors;
using Nop.Core.Domain.WindAlert;

namespace Nop.Admin.WindAlert
{
    public static class MappingExtensions
    {
        public static TDestination MapTo<TSource, TDestination>(this TSource source)
        {
            return Mapper.Map<TSource, TDestination>(source);
        }

        public static TDestination MapTo<TSource, TDestination>(this TSource source, TDestination destination)
        {
            return Mapper.Map(source, destination);
        }

        #region  Cameras

        public static CameraModel ToModel(this Camera entity)
        {
            return entity.MapTo<Camera, CameraModel>();
        }

        public static Camera ToEntity(this CameraModel model)
        {
            return model.MapTo<CameraModel, Camera>();
        }

        public static Camera ToEntity(this CameraModel model, Camera destination)
        {
            return model.MapTo(destination);
        }
        #endregion

        #region Wind Spot

        public static SpotModel ToModel(this Spot entity)
        {
            return entity.MapTo<Spot, SpotModel>();
        }

        public static Spot ToEntity(this SpotModel model)
        {
            return model.MapTo<SpotModel, Spot>();
        }

        public static Spot ToEntity(this SpotModel model, Spot destination)
        {
            return model.MapTo(destination);
        }
        #endregion

        #region Wind Alert

        public static SpotsGroupModel ToModel(this SpotsGroup entity)
        {
            return entity.MapTo<SpotsGroup, SpotsGroupModel>();
        }

        public static SpotsGroup ToEntity(this SpotsGroupModel model)
        {
            return model.MapTo<SpotsGroupModel, SpotsGroup>();
        }

        public static SpotsGroup ToEntity(this SpotsGroupModel model, SpotsGroup destination)
        {
            return model.MapTo(destination);
        }
        #endregion

        #region mobile device

        public static MobileDeviceModel ToModel(this MobileDevice entity)
        {
            return entity.MapTo<MobileDevice, MobileDeviceModel>();
        }

        public static MobileDevice ToEntity(this MobileDeviceModel model)
        {
            return model.MapTo<MobileDeviceModel, MobileDevice>();
        }

        public static MobileDevice ToEntity(this MobileDeviceModel model, MobileDevice destination)
        {
            return model.MapTo(destination);
        }
        #endregion

    }
}